﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EIA.BLLTool
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "*.dll|*.dll";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                this.textBox1.Text = ofd.FileName;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog ofd = new FolderBrowserDialog();
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                this.textBox2.Text = ofd.SelectedPath;
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            DotNETX.Utility.Config.IniFile ini = new DotNETX.Utility.Config.IniFile(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "setting.ini"));
            ini.Set("Common", "dll", textBox1.Text);
            ini.Set("Common", "output", textBox2.Text);
            BllTemplate tem = new BllTemplate(textBox1.Text, textBox2.Text);
            tem.Generate(System.IO.Path.GetFileName(textBox1.Text));
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            DotNETX.Utility.Config.IniFile ini = new DotNETX.Utility.Config.IniFile(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "setting.ini"));
            textBox1.Text = ini.Get("Common", "dll");
            textBox2.Text = ini.Get("Common", "output");
        }
    }
}
